package br.com.wai2008.client.serial;

import java.io.BufferedReader;

import br.com.wai2008.client.system.SystemCommand;

/**
 * This class calls a system command execution which gets the
 * HD parameters from the machine.<br>
 * This class only implements an execution of Linux system commands. In order
 * to perform the correct execution, you must give 'sudo' access
 * without password to the user who will execute these command. 
 * 
 * @since 
 * 		September, 2008.
 * 
 * @version
 * 		WAI2008 - version 1.0
 * 
 * @author 
 * 		Andre Romero Goncales
 */
public class HDSerialNumber {

	/**
	 * Calls an execution of 'hdparm' command that returns
	 * all HD parameters from the machine.<br>
	 * The command executed is 'sudo hdparm -i /dev/sda'.<br>
	 * In order to correctly execute this system command, give 'sudo'
	 * access to the user who will execute this command.
	 * 
	 * @see
	 * 		br.com.wai2008.client.system.SystemCommand
	 * 
	 * @return
	 * 		The system command execution for 'hdparm' in a buffer or <b>null</>
	 * 		if an error occurs.
	 */
	public static BufferedReader getSerial() {
		System.out.println("[HDSerialNumber] Getting HD serial number...");
		String[] getHDNumber = new String[]{"sudo", "hdparm", "-i", "/dev/sda"};
		return SystemCommand.executeSystemCommand(getHDNumber);
	}
}
